package com.meis.widget.xiaohongshu;

import com.meis.widget.ResourceTable;
import ohos.agp.components.AttrSet;
import ohos.agp.components.Component;
import ohos.agp.components.DirectionalLayout;
import ohos.agp.components.Image;
import ohos.app.Context;
import org.jetbrains.annotations.Nullable;

import java.util.logging.Level;
import java.util.logging.Logger;

/**
 * Created by wenshi on 2019/3/6.
 * Description
 */
public class SquareLinearLayout extends DirectionalLayout implements Component.EstimateSizeListener {
    public SquareLinearLayout(Context context) {
        super(context);
        setEstimateSizeListener(this);
    }

    public SquareLinearLayout(Context context, @Nullable AttrSet attrs) {
        super(context, attrs);
        setEstimateSizeListener(this);
    }

    public SquareLinearLayout(Context context, @Nullable AttrSet attrs, String defStyleAttr) {
        super(context, attrs, defStyleAttr);

        setEstimateSizeListener(this);
    }

    @Override
    public boolean onEstimateSize(int i, int i1) {
        setEstimatedSize(EstimateSpec.getSize(i), EstimateSpec.getSize(i));

//        Component componentAt = getComponentAt(0);
//        Component componentAt1 = getComponentAt(1);
//        Component componentAt2 = getComponentAt(2);
//        Component componentAt3 = getComponentAt(3);
//        if(componentAt != null){
//            componentAt.estimateSize(i, i);
////            ((Image) componentAt).setPixelMap(ResourceTable.Media_mei_ic_praise_1);
//        }
//        if(componentAt1 != null){
//            componentAt1.estimateSize(i, i);
////            ((Image) componentAt).setPixelMap(ResourceTable.Media_mei_ic_praise_1);
//        }
//        if(componentAt2 != null){
//            componentAt2.estimateSize(i, i);
////            ((Image) componentAt).setPixelMap(ResourceTable.Media_mei_ic_praise_1);
//        }
//        if(componentAt3 != null){
//            componentAt3.estimateSize(i, i);
////            ((Image) componentAt).setPixelMap(ResourceTable.Media_mei_ic_praise_1);
//        }

        return false;
    }
}
